package com.zhangxiaofanfan.hotcode.first;

/**
 *
 * @date 2024-07-13 03:14:13
 * @author zhangxiaofanfan
 */
public class HotCode081 {
    public static void main(String[] args) {
        HotCode081 hotCode = new HotCode081();
        System.out.println(hotCode.climbStairs(10));
    }

    public int climbStairs(int n) {
        int[] mode = new int[] {1, 2};
        if (n == 1 || n == 2) {
            return n;
        }
        for (int i = 3; i <= n; i++) {
            int curSum = mode[0] + mode[1];
            mode[0] = mode[1];
            mode[1] = curSum;
        }
        return mode[1];
    }
}
